package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.pojo.db1.PcbaDeviceRelatedTechParamActual;
import com.sailfish.springbootdemo.service.db1.PcbaDeviceRelatedTechParamActualService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/pcbaDeviceRelatedTechParamActual")
public class PcbaDeviceRelatedTechParamActualController {

    @Autowired
    private PcbaDeviceRelatedTechParamActualService pcbaDeviceRelatedTechParamActualService;

    @PostMapping("/getAllByDeviceIdActual")
    public Result getAllByDeviceIdActual(Integer pcbaDeviceId) {
        try {
            if (pcbaDeviceId == null || "".equals(pcbaDeviceId.toString())) {
                return ResultUtil.error(500, "缺少参数pcbaDeviceId", "Miss Param pcbaDeviceId", null);
            }
            return ResultUtil.success(pcbaDeviceRelatedTechParamActualService.getAllByDeviceIdActual(pcbaDeviceId));
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.error(500, e.getMessage(), e.getMessage(), null);
        }
    }
}
